{% extends 'bootstrap-modal-layout.html.twig' %}

{% set modal_class = 'cd-modal-dialog' %}

{% do script(['libs/jquery-validation.js','app/js/settings/password/index.js']) %}

{% block title %}
  {{'user.settings.security.password_modify'|trans}}
{% endblock %}

{% block body %}

  {% if not app.user.password %}
    <div class="alert cd-alert cd-alert-warning">
      {{ 'user.settings.security.no_password_tips'|trans({'%passwordResetUrl%': path('password_reset')})|raw }}
    </div>
  {% else %}
    <form id="settings-password-form" method="post" action="{{ path('settings_password') }}">
      <div class="form-group cd-form-group">
        <label for="form_currentPassword">
          {{'user.settings.security.password_modify.current_password'|trans}}
        </label>
        <input type="password" id="form_currentPassword" name="currentPassword" required="required" class="form-control" placeholder="{{'user.settings.security.password_modify.current_password_placeholder'|trans}}">
      </div>

      <div class="form-group cd-form-group">
        <label for="form_newPassword">
          {{'user.settings.security.password_modify.new_password'|trans}}
      </label>
        <input type="password" id="form_newPassword" name="newPassword" required="required" class="form-control" placeholder="{{'user.settings.security.password_modify.new_password_placeholder'|trans}}">
      </div>

      <div class="form-group cd-form-group cd-mb24">
        <label for="form_confirmPassword">
          {{'user.settings.security.password_modify.confirm_password'|trans}}
        </label>
        <input type="password" id="form_confirmPassword" name="confirmPassword" required="required" class="form-control" placeholder="{{'user.settings.security.password_modify.confirm_password_placeholder'|trans}}">
      </div>
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
  {% endif %}
{% endblock %}

{% block footer %}
  <button type="button" class="btn cd-btn cd-btn-flat-default cd-btn-lg" data-dismiss="modal">
    {{'form.btn.cancel'|trans}}
  </button>
  <button id="password-save-btn" type="button" class="btn cd-btn cd-btn-primary cd-btn-lg" data-toggle="form-submit"  data-target="#settings-password-form" data-loading-text="{{'form.btn.save.submiting'|trans}}">{{'form.btn.submit'|trans}}</button>
{% endblock %}
